package com.sky.mapper;

import com.sky.dto.GoodsSalesDTO;
import com.sky.entity.OrderDetail;
import com.sky.entity.Orders;
import com.sky.vo.OrderVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper {

    void insert(Orders order);

    //List<OrderVO> list(Orders orders,  LocalDateTime beginTime,LocalDateTime endTime);
    List<OrderVO> list(@Param("orders") Orders orders, @Param("beginTime") LocalDateTime beginTime,
                       @Param("endTime") LocalDateTime endTime);

    @Select("select * from sky_take_out.orders where number=#{number}")
    Orders getByNumber(String number);

    void update(Orders orders);

    void updateTimeOutOrder(Integer status,LocalDateTime limitTime);

    @Select("select * from sky_take_out.orders where status=#{status} and order_time<=#{limitTime}")
    List<Orders> getByStatusAndOrderTime(Integer status, LocalDateTime limitTime);

    Double sumByMap(Map<String, Object> map);

    List<GoodsSalesDTO> getSalesTop10(LocalDateTime beginTime, LocalDateTime endTime);
}
